package cn.eli.vue.service.artical.impl;

import cn.eli.vue.entity.Artical;
import cn.eli.vue.entity.LikeArtical;
import cn.eli.vue.entity.SubscribeArtical;
import cn.eli.vue.mapper.artical.ArticalMapper;
import cn.eli.vue.service.artical.ArticalService;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticalServiceImpl implements ArticalService {
    @Autowired
    ArticalMapper articalMapper;

    /*发布文章*/
    @Override
    public int ArticalPost(int user_id, String artical_title, String artical_discribe, String artical_img){
        return articalMapper.ArticalPost(user_id,artical_title,artical_discribe,artical_img);
    }
    /*修改文章*/
    public  int ArticalModify(int artcal_id,String artical_title,String artical_discribe, String artical_img){
        return articalMapper.ArticalModify(artcal_id,artical_title,artical_discribe,artical_img);
    }
    /*评论文章*/
    public int ArticalComment(int artical_id,int user_id,String commentArtical_discribe){
        return articalMapper.ArticalComment(artical_id,user_id,commentArtical_discribe);
    }
    /*收藏文章*/
    public int ArticalSubscribeInsert(int artical_id,int user_id){
        return articalMapper.ArticalSubscribeInsert(artical_id,user_id);
    }
    /*收藏文章*/
    public int ArticalSubscribeUpdate(int artical_id,int user_id){
        return articalMapper.ArticalSubscribeUpdate(artical_id,user_id);
    }
    /*取消收藏文章*/
    public int ArticalSubscribeCancelDelete(int artical_id,int user_id){
        return articalMapper.ArticalSubscribeCancelDelete(artical_id,user_id);
    }
    /*取消收藏文章*/
    public int ArticalSubscribeCancelUpdate(int artical_id,int user_id){
        return articalMapper.ArticalSubscribeCancelUpdate(artical_id,user_id);
    }
    /*点赞文章*/
    public int ArticalLikeInsert(int artical_id,int user_id){
        return articalMapper.ArticalLikeInsert(artical_id,user_id);
    }
    /*点赞文章*/
    public int ArticalLikeUpdate(int artical_id,int user_id){
        return articalMapper.ArticalLikeUpdate(artical_id,user_id);
    }
    /*取消点赞文章*/
    public int ArticalLikeCancelDelete(int artical_id,int user_id){
        return articalMapper.ArticalLikeCancelDelete(artical_id,user_id);
    }
    /*取消点赞文章*/
    public int ArticalLikeCancelUpdate(int artical_id,int user_id){
        return articalMapper.ArticalLikeCancelUpdate(artical_id,user_id);
    }
    /*获取所有的文章*/
    public List<Artical> AllArtical(){
        return articalMapper.AllArtical();
    }
    /*获取某个用户的所有文章*/
    public List<Artical> AllArticalInUser(int user_id){
        return articalMapper.AllArticalInUser(user_id);
    }
    /*获取某个用户点赞的文章*/
    public List<LikeArtical> AllArticalInLike(int user_id){
        return articalMapper.AllArticalInLike(user_id);
    }
    /*获取某个用户收藏的文章*/
    public List<SubscribeArtical> AllArticalInSubscribe(int user_id){
        return articalMapper.AllArticalInSubscribe(user_id);
    }
    /*从id获取实体*/
    public Artical ArticalIdToArtical(int artical_id){
        return articalMapper.ArticalIdToArtical(artical_id);
    }
}
